import Vue from 'vue'
import VueRouter from 'vue-router'

import Login from '@/views/one/login.vue'
import Register from '@/views/one/register.vue'
import Layout from '@/views/one/layout.vue'

import Home from '@/views/two/home.vue'
import Find from '@/views/two/find.vue'
import Info from '@/views/two/info.vue'
import User from '@/views/two/user.vue'
import CityBar from '@/views/three/cityBar.vue'

import NotFound from '@/views/notFound.vue'

Vue.use(VueRouter)

const routes = [
  // 重定向
  {
    path: '',
    redirect: '/layout'
  },
  {
    path: '/login',
    component: Login
  },
  {
    path: '/register',
    component: Register
  },
  {
    path: '/layout',
    component: Layout,
    redirect: '/layout/home',
    children: [
      {
        path: 'home',
        component: Home
      },
      {
        path: 'find',
        component: Find
      },
      {
        path: 'info',
        component: Info
      },
      {
        path: 'user',
        component: User
      }
    ]
  },
  {
    path: '/cityBar',
    component: CityBar
  },
  {
    path: '*',
    component: NotFound
  }
]

const router = new VueRouter({
  routes
})

export default router
